<!--
 * @Author: 施伟略
 * @Date: 2020-06-29 15:28:04
 * @LastEditTime: 2020-07-02 17:42:31
 * @LastEditors: Please set LastEditors
 * @Description: 问题详情
 * @FilePath: \jkShop\shop\src\pages\help\components\questionDetails.vue
--> 
<template>
  <div class="questionDetails">
    <!-- 顶部导航 -->
    <van-nav-bar :title="category.name" left-text="返回" left-arrow @click-left="onClickLeft" />
    <!-- 搜索结果统计 -->
    <div class="total">{{'全部问题'+'>'+category.name+'>'+'问题详情'}}</div>
    <div class="question">{{'Q：'+datas.title}}</div>
    <div class="content">
      <div class="a">A:</div>
      <div class="answer">
        <div class="answer-h" v-html="datas.content"></div>
      </div>
    </div>
  </div>
</template>

<script>
import * as api from "@/api/apiList/help/help.js";
export default {
  props: ["id"],
  data() {
    return {
      datas: [], //问题详情数据
      category: {}, //标题导航
    };
  },
  methods: {
    // 返回上一页
    onClickLeft() {
      this.$router.go(-1);
    },
    // 获取问题详情数据
    async API_detail(a) {
      return await api.help_detail(a);
    },
    async init(id) {
      let res = await this.API_detail(id);
      // console.log(res)
      this.datas = res.data.data
      // console.log(this.datas)
      this.category = res.data.data.category
      // console.log(this.category)
    }
  },

  async activated() {
    await this.init(this.id);
    // console.log(this.id)
  }
};
</script>

<style lang="scss" scoped>
@import "@/style/help/help.scss"
</style>